/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VentanaTelefonos.java
 *
 * Created on 13-oct-2011, 2:18:40
 */
package Interfaz;

import java.util.*;

import Dominio.*;

/**
 *
 * @author GusKus
 */
public class VentanaTelefonos extends javax.swing.JFrame {
    
    private SistemaCarne modelo;
    private Niño niño;

    /** Creates new form VentanaTelefonos */
    public VentanaTelefonos() {
        initComponents();
    }
    
     public VentanaTelefonos(SistemaCarne unSistema, Niño unNiño) {
        modelo = unSistema;
        niño = unNiño;
        initComponents();
        jTable1.setValueAt(niño.getCarne().getTelefImportantes()[0], 0, 0);
        jTable1.setValueAt(niño.getCarne().getTelefImportantes()[1], 1, 0);
        jTable1.setValueAt(niño.getCarne().getTelefImportantes()[2], 2, 0);
        jTable1.setValueAt(niño.getCarne().getTelefImportantes()[3], 3, 0);
        jTable1.setValueAt(niño.getCarne().getTelefImportantes()[4], 4, 0);

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jBtnSalir = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBackground(new java.awt.Color(255, 255, 255));
        setBounds(new java.awt.Rectangle(200, 100, 400, 470));
        setMinimumSize(new java.awt.Dimension(400, 470));
        setResizable(false);
        getContentPane().setLayout(null);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(255, 0, 0));
        jLabel1.setText("Teléfonos importantes");
        getContentPane().add(jLabel1);
        jLabel1.setBounds(90, 10, 200, 20);

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel2.setText("Apoyo a la mujer víctima de la violencia 08001414");
        getContentPane().add(jLabel2);
        jLabel2.setBounds(50, 220, 310, 15);

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel3.setText("Atención a usuarios MSP 08004444");
        getContentPane().add(jLabel3);
        jLabel3.setBounds(50, 40, 220, 15);

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel4.setText("Emergencias 911");
        getContentPane().add(jLabel4);
        jLabel4.setBounds(50, 70, 220, 15);

        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel5.setText("Intoxicaciones (CIAT) 1722");
        getContentPane().add(jLabel5);
        jLabel5.setBounds(50, 100, 220, 15);

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel6.setText("Línea azul (INAU) 08005050");
        getContentPane().add(jLabel6);
        jLabel6.setBounds(50, 130, 220, 15);

        jLabel7.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel7.setText("Bomberos 104");
        getContentPane().add(jLabel7);
        jLabel7.setBounds(50, 160, 220, 15);

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel8.setText("Jefatura 1909");
        getContentPane().add(jLabel8);
        jLabel8.setBounds(50, 190, 220, 15);

        jTable1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null},
                {null},
                {null},
                {null},
                {null}
            },
            new String [] {
                "Otros teléfonos importantes"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jTable1.setRowHeight(20);
        jScrollPane1.setViewportView(jTable1);

        getContentPane().add(jScrollPane1);
        jScrollPane1.setBounds(50, 260, 290, 130);

        jBtnSalir.setText("Salir");
        jBtnSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnSalirActionPerformed(evt);
            }
        });
        getContentPane().add(jBtnSalir);
        jBtnSalir.setBounds(160, 410, 73, 23);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jBtnSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnSalirActionPerformed
        String primero = jTable1.getValueAt(0,0).toString();
        String segundo = jTable1.getValueAt(1,0).toString();
        String tercero = jTable1.getValueAt(2,0).toString();
        String cuarto = jTable1.getValueAt(3,0).toString();
        String quinto = jTable1.getValueAt(4,0).toString();
        niño.getCarne().cargarTelefonos(primero, segundo, tercero, cuarto, quinto);
        this.dispose();
    }//GEN-LAST:event_jBtnSalirActionPerformed
   
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBtnSalir;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    // End of variables declaration//GEN-END:variables
}
